package com.songxh.core.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**  web配置  与AccessTokenInterceptor拦截器一起使用
 * @author songxh
 * @create 2022-12-29-17:18
 */
@Configuration
public class WebConfiguration implements WebMvcConfigurer {

    @Autowired
    private AccessTokenInterceptor accessTokenInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //token拦截器,拦截所有请求
        registry.addInterceptor(accessTokenInterceptor).addPathPatterns("/**");
    }
}
